AUTOMAKE_OPTIONS = subdir-objects
ACLOCAL_AMFLAGS = -I m4

bin_PROGRAMS = src/mujs
src_mujs_LDADD = src/libmujs.la
src_mujs_SOURCES = src/main.cpp

include_HEADERS=src/mujs.h

src/astnames.h: src/jsparse.h
	grep -E '(AST|EXP|STM)_' src/jsparse.h | sed 's/^[^A-Z]*\(AST_\)*/"/;s/,.*/",/' | tr A-Z a-z > $@

src/opnames.h: src/jscompile.h
	grep -E 'OP_' src/jscompile.h | sed 's/^[^A-Z]*OP_/"/;s/,.*/",/' | tr A-Z a-z > $@

BUILT_SOURCES= \
  src/astnames.h \
  src/opnames.h

CLEANFILES = \
  src/astnames.h \
  src/opnames.h

lib_LTLIBRARIES = src/libmujs.la
src_libmujs_la_DEPENDENCIES = \
  src/astnames.h \
  src/opnames.h

src_libmujs_la_SOURCES = \
  src/jsarray.c \
  src/jsboolean.c \
  src/jsbuiltin.c \
  src/jsbuiltin.h \
  src/jscompile.c \
  src/jscompile.h \
  src/jsdate.c \
  src/jsdtoa.c \
  src/jsdump.c \
  src/jserror.c \
  src/jsfunction.c \
  src/jsgc.c \
  src/jsi.h \
  src/jsintern.c \
  src/jslex.c \
  src/jslex.h \
  src/jsmath.c \
  src/jsnumber.c \
  src/jsobject.c \
  src/json.c \
  src/jsparse.c \
  src/jsparse.h \
  src/jsproperty.c \
  src/jsregexp.c \
  src/jsrun.c \
  src/jsrun.h \
  src/jsstate.c \
  src/jsstring.c \
  src/jsvalue.c \
  src/jsvalue.h \
  src/regex.c \
  src/regex.h \
  src/utf.c \
  src/utf.h \
  src/utftype.c 
